<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<%@page import="com.ckeditor.CKEditorConfig"%>
<s:action name="header" executeResult="true">
	<s:param name="titles">Quản lý thông tin</s:param>
</s:action>
<s:action name="managesidebar" executeResult="true" />

<!-- Center -->
<div id="center_column_des" class="center_column">

<div class="breadcrumb">
	<a href="<s:url action="index"></s:url>">Trang chủ</a><span class="navigation-pipe">&gt;</span><span class="navigation_page">Quản lý thông tin</span>
</div>
<!-- /Breadcrumb -->
	<form action="<s:url action="manageaboutus"></s:url>" method="post" class="std" enctype="multipart/form-data" name="aboutus" id="aboutus">
		<fieldset>
			<h3>Về chúng tôi</h3>
			<table class="form">
				<tr>
					<td>Tiêu đề :</td>
					<td><input type="text" name="title" id="title" maxlength="50" value="<s:property value="aboutus.title"/>" style="width:550px;"/></td>
				</tr>
				<tr>
					<td style="vertical-align:middle;">Nội dung :</td>
					<td><textarea rows="5" cols="80" name="content" id="content"><s:property value="aboutus.content" escapeHtml="false"/></textarea></td>
				</tr>
			</table>
			<p class="submit" style="padding:10px 0 0 250px;">
				<input type="submit" name="submitMessage" id="submitMessage"
					value="Lưu" class="button_large">
			</p>
		</fieldset>
	</form>
			<% 
				CKEditorConfig settings = new CKEditorConfig();
				settings.addConfigValue("width", "550");
				settings.addConfigValue("toolbar", "[['Format','Font','FontSize'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],['Link','Unlink','Anchor'],['TextColor','BGColor'],['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],]");
			%>	
	<ckeditor:replace replace="content" basePath="js/ckeditor/" config="<%=settings %>"/>
	<!-- /MODULE contact -->
<script type="text/javascript">
$().ready(function() {
	$('#submitMessage').click(function() { 		 
        $(".error").remove();
        var hasError = false;

        var titleVal = $("#title").val();
        var messageVal = $("#content").val();
        var editor = CKEDITOR.instances['content'].getData();

        if($.trim(titleVal) == '') {
            $("#title").after('<span style="margin-left: 5px;margin-top: 5px;color: #CC0000;" class="error">Vui lòng nhập tiêu đề.</span>');
            hasError = true;
        }
        
        if($.trim(editor) == '') {
            $("#cke_content").after('<span style="margin-left: 5px;margin-top: 5px;color: #CC0000;" class="error" >Vui lòng nhập nội dung.</span>');
            hasError = true;
        }        
        
        if(hasError == true) { return false; }

    }); 
});

</script>	
</div>

<s:action name="footer" executeResult="true" />